<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>体育与健康课程管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/main.css"/>
    <link href="${pageContext.request.contextPath}/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/jquery-3.2.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/public/js/layer/layer.js"></script>
</head>
<body>
<div class="container clearfix" style="width:100%">
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list" style="background:#fff; border:0px"><i class="icon-font"></i>修改密码</div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form  id="myform">
                    <table class="insert-tab" >
                        <tbody>   
                            <tr>
                                <th><i class="require-red">*</i>原密码：</th>
                                <td>
                                    <input class="common-text required" id="title" name="repassword" size="85" style="width:300px;height:32px" type="password">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>新密码：</th>
                                <td>
                                    <input class="common-text required" id="title" name="password" size="85"  style="width:300px;height:32px" type="password">
                                </td>
                            </tr>
                                <tr>
                                <th><i class="require-red">*</i>再次输入密码：</th>
                                <td>
                                    <input class="common-text required" id="title" name="newpassword" size="85"  style="width:300px;height:32px" type="password">
                                </td>
                            </tr>
                           <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="button">
                                    <input class="btn btn6"  onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
</body>
<script type="text/javascript">
    $('.mr10').click(function(){ 
		var repassword=$("input[name=repassword]");
		var password=$("input[name=password]");
		var newpassword=$("input[name=newpassword]");
		
		if(repassword.val()==""){
			layer.msg('密码不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
			repassword.focus();
			return ;
		}
		if(password.val()==""){
			layer.msg('密码不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
			password.focus();
			return ;
		}
		if(newpassword.val()==""){
			layer.msg('密码不能为空', { offset: ['0px', '40%'], icon:7,time:2000});  
			newpassword.focus();
			return ;
		}
		
		if(password.val()!=newpassword.val()){
			 layer.msg('密码不一致', { offset: ['0px', '40%'], icon:7,time:2000});  
			newpassword.focus();
			return ;
		}
		
		$.post("${pageContext.request.contextPath}/usersys/updatepass.action",{repassword:repassword.val(),password:password.val()},function(returndata){
			 if(returndata.code==1){
	            layer.msg(returndata.message, { offset: ['0px', '40%'], icon:6,time:1000},function(){
	              location.reload(); 
	            });
	          }
	          else
	            layer.msg(returndata.message, { offset: ['0px', '40%'], icon:5,time:2000});
		});
    });
</script>
</html>